# !/bin/sh

ls -la

if [ -f "readme.md" ];then
    mv readme.md README.md
fi
if [ ! -f "README.md" ];then
    echo "no readme.md"
    exit 1
fi

if [ -f "answer.md" ];then
    mv answer.md ANSWER.md
fi

if [ ! -f "script.sh" ];then
    echo "ls" > script.sh
    chmod +x script.sh
fi

if [ ! -f "ANSWER.md" ];then
    echo "ANSWER.md" > ANSWER.md
fi

rm -fr .git

zip -r answer.zip ./*

curl -X POST  \
    -F "script=@script.sh" \
    -F "answer=@answer.zip" \
    -F "readme=@README.md" \
    -F "answerDescription=@ANSWER.md" \
    -F "status=2" \
    -F "result=创建单栈编程题成功" \
    -F "buildNumber=${BUILD_NUMBER}" \
    -F "templateRepository=https://github.com/recruiting-system/$TIME_STRING.git" \
    $callback_url
